package com.stone.inventory.sharding.helper;

import java.util.SortedMap;
import java.util.TreeMap;

/**
 * @author Mr_wenpan@163.com 2021/08/16 22:16
 */
public class Test {

    public static void main(String[] args) {
        final int a = 7;
        // 0111
        // 把-1左移a位
        System.out.println(-1 << a);
        // 把1左移7位
        System.out.println(1 << 7);
        System.out.println(~(-1 << a));
        System.out.println(-10 >> 2);
        System.out.println(2 << 10);

        System.out.println("================================");
        testTailMap(args);
    }

    public static void testTailMap(String[] args) {
        // creating maps
        TreeMap<Integer, String> treemap = new TreeMap<Integer, String>();
        SortedMap<Integer, String> treemapincl = new TreeMap<Integer, String>();

        // populating tree map
        treemap.put(2, "two");
        treemap.put(1, "one");
        treemap.put(3, "three");
        treemap.put(6, "six");
        treemap.put(5, "five");

        System.out.println("Getting tail map");
        treemapincl = treemap.tailMap(4);
        System.out.println("Tail map values: " + treemapincl);
    }
}
